<?php
	include "../ketnoi.php";
	$SoKheUoc = $_POST["SoKheUoc"];
	$SoHDTC = $_POST["SoHDTC"];
	$QuanHeVoiKH = $_POST["QuanHeVoiKH"];
	$SoThangVay = $_POST["SoThangVay"];
	$LaiSuatQuaHan = $_POST["LaiSuatQuaHan"];
	$SoTienVay = $_POST["SoTienVay"];
	$MucDichChoVay = $_POST["MucDichVay"];
	$NgayLapHopDong = $_POST["NgayLapHopDong"];
	$NgayDenHan = $_POST["NgayDenHan"];
	$HinhThucXuLy = $_POST["HinhThucXuLy"];
	$hopdongtindung = new hopdongtindungbs();

	
	$sql = "UPDATE hopdongtindung set SoHDTC = '$SoHDTC', QuanHeVoiKH = '$QuanHeVoiKH', SoThangVay = $SoThangVay, LaiSuatQuaHan = $LaiSuatQuaHan, SoTienVay = $SoTienVay, MucDichChoVay = '$MucDichChoVay', NgayLapHopDong = '$NgayLapHopDong', NgayDenHan = '$NgayDenHan', HinhThucXuLy = '$HinhThucXuLy' where  SoKheUoc = '$SoKheUoc'";

	$kq = mysql_query($sql);
	if($kq)
	{
		session_start();
		$nhatky = new nhatkybs();
		$nhatky->TenSuKien = "Sửa thông tin hợp đồng tín dụng";
		$nhatky->MaNguoiDung = $_SESSION["MaND"];
		date_default_timezone_set('Asia/Ho_Chi_Minh');
		$nhatky->ThoiGian = date("Y-m-d H:m:s", time());
		$nhatky->Them();
		header("Location:index.php?do=hopdongtindung");
	}
	else 
	{
		$_SESSION["LoiSuaHopDongTinDung"]= "Lỗi ".mysql_error();
		header("Location:index.php?do=hopdongtindung");
	}
?>